home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / m68k / 200 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.9 KB

  1. Path: news.infinet.com!usenet
  2. From: Paul Swetnam <pswetnam@infinet.com>
  3. Newsgroups: comp.sys.m68k
  4. Subject: Re: Bus Error Handler for 68040
  5. Date: Fri, 02 Feb 1996 08:50:37 -0800
  6. Organization: Aeroflex Lintek Corp.
  7. Message-ID: <311240DD.7A42@infinet.com>
  8. References: <30FFE81F.4110@infinet.com> <823212746.11237@fpfnet.demon.co.uk>
  9. NNTP-Posting-Host: cmh-p095.infinet.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b6b (Win16; I)
  14.  
  15. Thanks to everyone's help. I've received some private email along with 
  16. the newsgroup posts, so I wanted to post a follow up message describing 
  17. my solution for all to see.
  18.  
  19. (Sorry this message is in such a funny place, my news server has already 
  20. dropped the main message thread and left me with only a few response 
  21. threads on which to post)
  22.  
  23. It turns out that by following each instruction which may cause a bus 
  24. error with a NOP, we can reliably process, log bus errors, and continue 
  25. code execution. The RTE instruction at the end of our bus error handler 
  26. always begins execution at the NOP following the instruction which caused 
  27. the bus error. We have written two functions hrd_vWriteWord() and 
  28. hrd_usReadWord() which have the NOP instruction built in. All VME bus 
  29. writes (the instructions which may cause bus errors) are routed through 
  30. these functions.
  31.  
  32. Ludis Langens provided me with an explanation:
  33.  
  34. > The 68040 has a different way of handling bus errors than earlier 68k
  35. > family members.  The 68010/020/030 use instruction continuation - in
  36. > other words they save all internal state information so that upon the
  37. > RTE the instruction can resume where it stopped.  This allows your
  38. > bus error handler to 'emulate' the missing memory.  The 68040 uses
  39. > instruction restart - internal registers are restored to the values
  40. > they held at the start of the instruction so that the RTE can run
  41. > the instruction over again.  The only time it won't do the instruction
  42. > over again is if it has already completed internally and just needs
  43. > a final write back.  The restart model makes emulation of missing
  44. > memory impossible unless you are willing to use a software emulation
  45. > of the complete instruction.  (For some instructions it is possible to
  46. > use an MMU trick but for others (like CMP (A0)+,(A0)+) this is not
  47. > possible.)
  48.  
  49. > I suspect that your use of NOPs seems to fix the problem because it
  50. > ensures that the following instruction (the NOP) does not cause a
  51. > bus error until the previous instruction has reached the write back
  52. > stage.  Alternately, perhaps the 68040 uses restart if a bus error
  53. > occurs if any instruction is partly executed (the faulting write OR
  54. > the following instruction.)  In this case the NOP keeps the execution
  55. > unit between instructions because it won't start until the bus is idle.
  56.  
  57. I have the source code from our solution if anyone is interested.
  58.  
  59. Will Koehler
  60. Design Engineer
  61. Aeroflex Lintek Corp.
  62.  
  63.  
  64.